﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="FilterDisplay.cs" company="None">
//   <Author>Adrian von Allmen, 2013</Author>
// </copyright>
// <summary>
//   Defines the FilterDisplay type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace CrumbleLibrary
{
    using System.Collections.Generic;

    /// <summary>
    /// Class for maintaining Filter and their values
    /// </summary>
    public class FilterDisplay
    {
        #region Public Properties

        /// <summary>
        /// Gets or sets the filter user control.
        /// </summary>
        public IFilterPlugins FilterUserControl { get; set; }

        /// <summary>
        /// Gets or sets the Display Name for Tab or other visual
        /// </summary>
        public string DisplayName { get; set; }
        #endregion

        #region Public Methods and Operators

        /// <summary>
        /// Get a parameter list which contain static and dynamic parameter values
        /// </summary>
        /// <returns>
        /// An Dictionary with objects.
        /// </returns>
        public Dictionary<string, object> GetList()
        {
            var currentTabControl = this.FilterUserControl;
            var completeList = currentTabControl.StaticParameterList;

            var dynamicvariableList = currentTabControl.DynamicParameterList;
            foreach (var item in dynamicvariableList)
            {
                if (completeList.ContainsKey(item.Name))
                {
                    completeList.Remove(item.Name);
                }

                completeList.Add(item.Name, item);
            }

            return completeList;
        }

        #endregion
    }
}
